<template>
  <!-- 专案终端信息资产 -->
  <div class="app-container">
    <el-form
	 v-loading="loading"
      :inline="true"
	  :disabled="disabled"
      :model="ruleForm"
      ref="ruleForm"
      class="demo-form-inline item"
      :rules="rules"
      :label-position="labelPosition"
      label-width="200px"
      style="margin-left: 100px;"
	  id="selectForm"
	  
    >
      <el-row
        type="flex"
        justify="space-between"
        align="middle"
        style="width: 70%; margin-left: 20px"
      >
        <el-col :span="24" :push="2">
          <el-divider content-position="center" class="title" 
            >NPI专案终端信息资产清单登记表</el-divider
          >
					<!-- 234567 -->
        </el-col>
      </el-row>
      <el-row type="flex" justify="space-between" align="middle" style="margin: 0px">
        <el-col :span="12" >
          <el-form-item  prop="entryTime" >
			   <span slot="label">
			        	<span style="font-size: 18px;">进入NPI时间</span>
			        </span>
            <el-date-picker
              v-model="ruleForm.entryTime"
              type="date"
              value-format="yyyy-MM-dd"
              placeholder="选择日期"
              style="width: 220px;"
            >
            </el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item  prop="handlerName" required>
			  <span slot="label">
			       	<span style="font-size: 18px;">终端处理人员</span>
			       </span>
            <el-input
              v-model="ruleForm.handlerName"
              value=""
              style="width: 220px;"
              readonly
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row
        type="flex"
        justify="space-between"
        align="middle"
        style="width: 70%; margin-left: 20px"
      >
        <el-col :span="24" :push="2"
          ><el-divider content-position="center" class="title"
            >专案及Lab信息</el-divider
          ></el-col
        >
      </el-row>
      <el-row type="flex" justify="space-between" align="middle" style="margin: 0px">
        <el-col :span="12" >
          <el-form-item label="厂 区 代 码" prop="factoryCode">
			  <span slot="label">
			       	<span style="font-size: 18px;">厂 区 代 码</span>
			       </span>
            <el-select v-model="ruleForm.factoryCode" placeholder="请选择厂区" style="width: 220px;font-size: 18px;">
              <el-option
                :label="item.label"
                :value="item.value"
                v-for="item in from.factoryCode"
                :key="item.id"
                style="width: 220px"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="I C T 专 案 代 码" prop="ictProjectCode">
			  <span slot="label">
			       	<span style="font-size: 18px;">I C T 专 案 代 码</span>
			       </span>
            <el-select
              v-model="ruleForm.ictProjectCode"
              placeholder="请选择ICT专案代码"
              style="width: 220px;font-size: 18px;"
            >
              <el-option
                :label="item.label"
                :value="item.value"
                v-for="item in from.ictProjectCode"
                :key="item.id"
                style="width: 220px;font-size: 18px;"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex" justify="space-between" align="middle" style="margin: 0px">
        <el-col :span="12" >
          <el-form-item label="专 案 楼 层" prop="projectFloor" >
			  <span slot="label">
			       	<span style="font-size: 18px;">专 案 楼 层</span>
			       </span>
            <el-select
              v-model="ruleForm.projectFloor"
              placeholder="请选择专案楼层"
              style="width: 220px;font-size: 18px;"
            >
              <el-option
                :label="item"
                :value="item"
                v-for="item in from.projectFloor"
                :key="item.id"
                style="width: 220px;font-size: 18px;"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="所 在 Lab 名 称" prop="labName">
			  <span slot="label">
			       	<span style="font-size: 18px;">所 在 Lab 名 称</span>
			       </span>
            <el-select
              v-model="ruleForm.labName"
              filterable
              allow-create
              default-first-option
              placeholder="请选择或填写"
              style="width: 220px;font-size: 18px;"
			  :popper-append-to-body="false"
			  popper-class="select-popper"
            >
              <el-option
                v-for="item in from.labName"
                :key="item.value"
                :label="item.label"
                :value="item.value"
                style="width: 220px;font-size: 18px;"
              >
              </el-option>
            </el-select>
            
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex" justify="space-between" align="middle" style="margin: 0px">
        <el-col :span="12" >
          <el-form-item label="所在Lab负责人工号" prop="labResponsibleId">
			  <span slot="label">
			       	<span style="font-size: 18px;">所在Lab负责人工号</span>
			       </span>
            <el-select
              v-model="ruleForm.labResponsibleId"
              filterable
              placeholder="请填写工号"
              @change="change1"
              remote
              :remote-method="remoteMethodId"
              style="width: 220px;font-size: 18px;"
            >
              <el-option
                v-for="item in labResponsibleId"
                :key="item.value"
                :label="item.empId"
                :value="item.empId"
                style="width: 220px;font-size: 18px;"
              >
                <span style="float: left">{{ item.empId }}</span>
                <span style="float: right">{{ item.empName }}</span>
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="L a b 负 责 人 邮 箱" prop="labResponsibleMail">
			  <span slot="label">
			       	<span style="font-size: 18px;">L a b 负 责 人 邮 箱</span>
			       </span>
            
            <el-input
              placeholder="根据工号查询"
              v-model="ruleForm.labResponsibleMail"
              value=""
              style="width: 220px;font-size: 18px;"
              readonly
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row
        style="width: 70%; margin-left: 20px"
        type="flex"
        justify="space-between"
        align="middle"
      >
        <el-col :span="24" :push="2">
          <el-divider content-position="center" class="title"
            >终端所属人个人信息</el-divider
          >
        </el-col>
      </el-row>
      <el-row type="flex" justify="space-between" align="middle" style="margin: 0px">
        <el-col :span="12" >
          <el-form-item label="电脑使用人工号" prop="userId">
			  <span slot="label">
			       	<span style="font-size: 18px;">电脑使用人工号</span>
			       </span>
            <el-select
              v-model="ruleForm.userId"
              filterable
              placeholder="请选择"
              @change="change2"
              remote
              :remote-method="remoteMethodId"
              style="width: 220px;font-size: 18px;"
            >
              <el-option
                v-for="item in labResponsibleId"
                :key="item.value"
                :label="item.empId"
                :value="item.empId"
                style="width: 220px;font-size: 18px;"
              >
                <span style="float: left font-size: 18px;">{{ item.empId }}</span>
                <span style="float: right font-size: 18px;">{{ item.empName }}</span>
              </el-option>
            </el-select>
           
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="电脑使用人姓名" prop="userName">
			  <span slot="label">
			       	<span style="font-size: 18px;">电脑使用人姓名</span>
			       </span>
            <el-input
              placeholder="根据工号查询"
              value=""
              v-model="ruleForm.userName"
              style="width: 220px;font-size: 18px;"
              readonly
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex" justify="space-between" align="middle" style="margin: 0px">
        <el-col :span="12" >
          <el-form-item label="电脑使用人职位" prop="userDuty">
			  <span slot="label">
			       	<span style="font-size: 18px;">电脑使用人职位</span>
			       </span>
            <el-input
              placeholder="根据工号查询"
              value=""
              v-model="ruleForm.userDuty"
              style="width: 220px;font-size: 18px;"
              readonly
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="电脑使用人邮箱" prop="userMail">
			  <span slot="label">
			       	<span style="font-size: 18px;">电脑使用人邮箱</span>
			       </span>
            <el-input
              placeholder="根据工号查询"
              value=""
              v-model="ruleForm.userMail"
              style="width: 220px;font-size: 18px;"
              readonly
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row
        type="flex"
        justify="space-between"
        align="middle"
        style="width: 70%; margin-left: 20px"
      >
        <el-col :span="24" :push="2">
          <el-divider content-position="center" class="title"
            >终端信息</el-divider
          >
        </el-col>
      </el-row>
      <el-row type="flex" justify="space-between" align="middle" style="margin: 0px">
        <el-col :span="12" >
          <el-form-item label="终 端 类 型" prop="terminalType">
			  <span slot="label">
			       	<span style="font-size: 18px;">终 端 类 型</span>
			       </span>
            <el-select
              v-model="ruleForm.terminalType"
              filterable
              allow-create
              default-first-option
              placeholder="请选择终端类型"
              style="width: 220px;font-size: 18px;"
            >
              <el-option
                v-for="item in from.terminalType"
                :key="item.id"
                :label="item"
                :value="item"
                style="width: 220px;font-size: 18px;"
              >
              </el-option>
            </el-select>
            
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="终 端 系 统" prop="terminalOs">
			  <span slot="label">
			       	<span style="font-size: 18px;">终 端 系 统</span>
			       </span>
            <el-select
              v-model="ruleForm.terminalOs"
              filterable
              allow-create
              default-first-option
              placeholder="请填写或选择"
              style="width: 220px;font-size: 18px;"
            >
              <el-option
                v-for="item in from.terminalOs"
                :key="item.value"
                :label="item.label"
                :value="item.value"
                style="width: 220px;font-size: 18px;"
              >
              </el-option>
            </el-select>
            
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex" justify="space-between" align="middle" style="margin: 0px">
        <el-col :span="12" >
          <el-form-item label="IP 地 址" prop="ipAddress">
			  <span slot="label">
			       	<span style="font-size: 18px;">IP 地 址</span>
			       </span>
            <el-input
              placeholder="自动填写"
              value=""
              v-model="ruleForm.ipAddress"
              style="width: 220px;font-size: 18px;"
              readonly
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="MAC地址" prop="macAddress">
			  <span slot="label">
			       	<span style="font-size: 18px;">MAC地址</span>
			       </span>
            <el-input
              placeholder="自动填写"
              value=""
              v-model="ruleForm.macAddress"
              style="width: 220px;font-size: 18px;"
              readonly
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex" justify="space-between" align="middle" style="margin: 0px">
        <el-col :span="12" >
          <el-form-item label="彩 条" prop="colourBar">
			  <span slot="label">
			       	<span style="font-size: 18px;">彩 条</span>
			       </span>
            <el-radio-group v-model="ruleForm.colourBar" style="width: 220px">
              <el-radio label="Y"><span style="font-size: 18px;">是</span></el-radio>
              <el-radio label="N"><span style="font-size: 18px;">否</span></el-radio>
            </el-radio-group>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="水 印" prop="watermark">
			  <span slot="label">
			       	<span style="font-size: 18px;">水 印</span>
			       </span>
            <el-radio-group v-model="ruleForm.watermark" style="width: 220px">
              <el-radio label="Y"><span style="font-size: 18px;">是</span></el-radio>
              <el-radio label="N"><span style="font-size: 18px;">否</span></el-radio>
            </el-radio-group>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex" justify="space-between" align="middle" style="margin: 0px">
        <el-col :span="12" >
          <el-form-item label="邮 箱 需 求" prop="mailPower">
			  <span slot="label">
			       	<span style="font-size: 18px;">邮 箱 需 求</span>
			       </span>
            <el-radio-group v-model="ruleForm.mailPower">
              <el-radio label="Y"><span style="font-size: 18px;">是</span></el-radio>
              <el-radio label="N"><span style="font-size: 18px;">否</span></el-radio>
            </el-radio-group>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="邮箱审核人工号" prop="mailAuditId">
			  <span slot="label">
			       	<span style="font-size: 18px;">邮箱审核人工号</span>
			       </span>
            <el-select
              v-model="ruleForm.mailAuditId"
              filterable
              placeholder="请选择"
              @change="change3"
              remote
              :remote-method="remoteMethodId"
              style="width: 220px;font-size: 18px;"
            >
              <el-option
                v-for="item in labResponsibleId"
                :key="item.value"
                :label="item.empId"
                :value="item.empId"
                style="width: 220px;font-size: 18px;"
              >
                <span style="float: left">{{ item.empId }}</span>
                <span style="float: right">{{ item.empName }}</span>
              </el-option>
            </el-select>
            
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex" justify="space-between" align="middle" style="margin: 0px">
        <el-col :span="12" >
          <el-form-item label="邮箱审核人职位" prop="mailAuditDuty">
			  <span slot="label">
			       	<span style="font-size: 18px;">邮箱审核人职位</span>
			       </span>
            <el-input
              placeholder="请填写邮箱审核人工号"
              value=""
              v-model="ruleForm.mailAuditDuty"
              style="width: 220px;font-size: 18px;"
              readonly
            ></el-input>
            
              
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="邮箱审核人邮箱" prop="mailAuditMail">
			  <span slot="label">
			       	<span style="font-size: 18px;">邮箱审核人邮箱</span>
			       </span>
            <el-input
              placeholder="根据工号查询"
              v-model="ruleForm.mailAuditMail"
              style="width: 220px;font-size: 18px;"
              readonly
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex" justify="space-between" align="middle" style="margin: 0px">
        <el-col :span="12" >
          <el-form-item label="USB 权 限" prop="usbPower">
			  <span slot="label">
			       	<span style="font-size: 18px;">USB 权 限</span>
			       </span>
            <el-radio-group v-model="ruleForm.usbPower">
              <el-radio label="Y"><span style="font-size: 18px;">是</span></el-radio>
              <el-radio label="N"><span style="font-size: 18px;">否</span></el-radio>
            </el-radio-group>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="电脑携出权限" prop="takeOut">
			  <span slot="label">
			       	<span style="font-size: 18px;">电脑携出权限</span>
			       </span>
            <el-radio-group v-model="ruleForm.takeOut">
              <el-radio label="Y"><span style="font-size: 18px;">是</span></el-radio>
              <el-radio label="N"><span style="font-size: 18px;">否</span></el-radio>
            </el-radio-group>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex" justify="space-between" align="middle" style="margin: 0px">
        <el-col :span="12" >
          <el-form-item label="双 因 素" prop="dualFactor">
			  <span slot="label">
			       	<span style="font-size: 18px;">双 因 素</span>
			       </span>
            <el-radio-group v-model="ruleForm.dualFactor">
              <el-radio label="Y"><span style="font-size: 18px;">是</span></el-radio>
              <el-radio label="N"><span style="font-size: 18px;">否</span></el-radio>
            </el-radio-group>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="令牌/指纹仪编号" prop="tokenId">
			  <span slot="label">
			       	<span style="font-size: 18px;">令牌/指纹仪编号</span>
			       </span>
            <el-input
              placeholder="手动填写"
              v-model="ruleForm.tokenId"
              style="width: 220px;font-size: 18px;"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row
        type="flex"
        justify="space-between"
        align="middle"
        style="width: 70%; margin-left: 20px"
      >
        <el-col :span="24" :push="2">
          <el-divider content-position="center" class="title"
            >客户系统</el-divider
          >
        </el-col>
      </el-row>
      <el-row type="flex" justify="space-between" align="middle" style="margin: 0px">
        <el-col :span="12" >
          <el-form-item label="是否有客户系统权限" prop="clientPower">
			  <span slot="label">
			       	<span style="font-size: 18px;">是否有客户系统权限</span>
			       </span>
            <el-radio-group v-model="ruleForm.clientPower">
              <el-radio label="Y"><span style="font-size: 18px;">是</span></el-radio>
              <el-radio label="N"> <span style="font-size: 18px;">否</span> </el-radio>
            </el-radio-group>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="sift 账 号" prop="siftAccount">
			  <span slot="label">
			       	<span style="font-size: 18px;">sift 账 号</span>
			       </span>
            <el-input
              placeholder="手动填写"
              v-model="ruleForm.siftAccount"
              style="width: 220px;font-size: 18px;"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex" justify="space-between" align="middle" style="margin: 0px">
        <el-col :span="12" >
          <el-form-item label="incline 账 号" prop="inclineAccount">
			  <span slot="label">
			       	<span style="font-size: 18px;">incline 账 号</span>
			       </span>
            <el-input
              placeholder="手动填写"
              v-model="ruleForm.inclineAccount"
              value=""
              style="width: 220px;font-size: 18px;"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="radar 账 号" prop="radarAccount">
			  <span slot="label">
			       	<span style="font-size: 18px;">radar 账 号</span>
			       </span>
            <el-input
              placeholder="手动填写"
              v-model="ruleForm.radarAccount"
              value=""
              style="width: 220px;font-size: 18px;"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex" justify="space-between" align="middle" style="margin: 0px">
        <el-col :span="12" >
          <el-form-item label="iMessage 账 号" prop="imessageAccount">
			  <span slot="label">
			       	<span style="font-size: 18px;">iMessage 账 号</span>
			       </span>
            <el-input
              placeholder="手动填写"
              v-model="ruleForm.imessageAccount"
              value=""
              style="width: 220px;font-size: 18px;"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row
        type="flex"
        justify="space-between"
        align="middle"
        style="margin: 0px"
        class="bottomBtn"
      >
        <el-col :span="7" >
          <el-form-item>
            <el-button type="primary" @click="saveChange(ruleForm)"
              >保存变更</el-button
            >
          </el-form-item>
        </el-col>
        <el-col :span="7" :push="1">
          <el-form-item>
            <el-button type="primary" @click="approve">提交审核</el-button>
          </el-form-item>
        </el-col>

        <el-col :span="7">
          <el-form-item>
            <el-button type="primary" @click="refresh">刷新</el-button>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </div>

</template>
<script>
import Cookies from "js-cookie";
import {
  addInforDemo,
  getInforDemo,
  getInforDemoList,
  updateInforDemo} from "../../../api/mine/inforDemo";
  import  {listFloor} from "@/api/mine/inforDemo.js"
// import { getInformationValue } from "@/api/mine/projectAuditMatter";
import{getoptionValue}from "@/api/info/projectMgmt.js"
      // 专案代码
export default {
  data() {
    return {
      disabled:false,
      loading: false,
      // 专案代码
      ictProjectCode: [],
      // ip地址
      ip: "",
      labelPosition: "left",
      // 所有员工
      labResponsibleId: [],
      ruleForm: {
		  createTime:null,
		  updateTime:null,
        imessageAccount: "",
        radarAccount: "",
        inclineAccount: "",
        siftAccount: "",
        clientPower: "",
        tokenId: "",
        dualFactor: "",
        takeOut: "",
        usbPower: "",
        mailAuditMail: "",
        mailAuditDuty: "",
        // mailAuditName:"",
        mailAuditId: "",
        mailPower: "",
        watermark: "",
        colourBar: "",
        macAddress: "",
        ipAddress: "",
        terminalOs: "",
        terminalType: "",
        userMail: "",
        userDuty: "",
        userName: "",
        userId: "",
        labResponsibleMail: "",
        labResponsibleId: "",
        labName: "",
        projectFloor: "",
        ictProjectCode: "",
        factoryCode: "",
        handlerName: "admin",
        // handlerId:"",
        entryTime: "",
        // 审核状态
        auditStatus: "",
      },
      rules: {
        entryTime: [{ required: true, message: "请选择时间", trigger: "blur" }],
        handlerId: [{ required: true, message: "请输入ID", trigger: "blur" }],
        handlerName: [
          { required: true, message: "请输入姓名", trigger: "blur" },
        ],
        factoryCode: [
          { required: true, message: "请选择厂区代码", trigger: "blur" },
        ],
        projectFloor: [
          { required: true, message: "请选择专案楼层", trigger: "blur" },
        ],
        ictProjectCode: [
          { required: true, message: "请选择专案", trigger: "blur" },
        ],
        labName: [
          { required: true, message: "请选择Lab名称", trigger: "blur" },
        ],
        labResponsibleId: [
          {
            required: true,
            message: "请输入所在Lab负责人工号",
            trigger: "blur",
          },
        ],
        labResponsibleMail: [
          {
            required: true,
            message: "请输入所在Lab负责人邮箱",
            trigger: "blur",
          },
        ],
        userId: [
          { required: true, message: "请输入Lab负责人工号", trigger: "blur" },
        ],
        userName: [
          { required: true, message: "请输入电脑使用人姓名 ", trigger: "blur" },
        ],
        userDuty: [
          { required: true, message: "请输入电脑使用人职位", trigger: "blur" },
        ],
        mailPower: [
          { required: true, message: "请选择是否有邮箱需求", trigger: "blur" },
        ],
        watermark: [
          { required: true, message: "请选择是否有水印", trigger: "blur" },
        ],
        userMail: [
          { required: true, message: "请输入电脑使用人邮箱", trigger: "blur" },
        ],
        terminalType: [
          { required: true, message: "请选择终端类型", trigger: "blur" },
        ],
        terminalOs: [
          { required: true, message: "请选择终端系统", trigger: "blur" },
        ],
        ipAddress: [
          { required: true, message: "请输入ip地址", trigger: "blur" },
        ],
        macAddress: [
          { required: true, message: "请输入MAC地址", trigger: "blur" },
        ],
        colourBar: [
          { required: true, message: "请选择是否有彩条", trigger: "blur" },
        ],
        mailAuditId: [
          { required: true, message: "请输入邮箱审核人工号", trigger: "blur" },
        ],
        mailAuditName: [
          { required: true, message: "请输入邮箱审核人姓名", trigger: "blur" },
        ],
        mailAuditDuty: [
          { required: true, message: '请输入"邮箱审核人职务', trigger: "blur" },
        ],
        mailAuditMail: [
          { required: true, message: "请输入邮箱审核人邮箱", trigger: "blur" },
        ],
        usbPower: [
          { required: true, message: "请选择是否有USB权限", trigger: "blur" },
        ],
        takeOut: [
          {
            required: true,
            message: "请选择是否有电脑携带权限",
            trigger: "blur",
          },
        ],
        dualFactor: [
          { required: true, message: "请选择双因素", trigger: "blur" },
        ],
        tokenId: [
          {
            required: true,
            message: "请选择是否有令牌/指纹编号",
            trigger: "blur",
          },
        ],
        clientPower: [
          {
            required: true,
            message: "请选择是否有客户系统权限",
            trigger: "blur",
          },
        ],
        siftAccount: [
          { required: true, message: "请输入SIFT账号", trigger: "blur" },
        ],
        inclineAccount: [
          { required: true, message: "请输入INCLINE账号", trigger: "blur" },
        ],
        imessageAccount: [
          { required: true, message: "请输入IMESSAGE账号", trigger: "blur" },
        ],
        radarAccount: [
          { required: true, message: "请输入RADAR账号", trigger: "blur" },
        ],
      },
      from: {
        // 厂区代码
        factoryCode: [1],
        // ICT专案
        ictProjectCode: [2],
        // 专案楼层
        projectFloor: [3],
        // 所在Lab名称
        labName: [4],
        // 终端类型
        terminalType: ["html"],
        // 终端系统
        terminalOs: [6],
        // 维护层面
        reqLevel: [],
        labResponsibleId: [],
      },
    };
  },
  methods: {
    saveChange(ruleForm) {
      // 保存变更
       this.$refs.ruleForm.validate((valid) => {
        if (
          this.ruleForm.macAddress == "" ||
          this.ruleForm.macAddress == null
        ) {
			let that=this
          this.$alert('<div>MAC地址为空，请点击<a href="https://gitee.com/xcj0654335/macaddr-chrome-extension" style="color:blue" target="_blank">下载插件</a>获取</div>', '标题名称', {
          	            dangerouslyUseHTMLString: true,
          	            callback: action => {
          				  that.disabled=true
          	            }
          	          });
        }
        if (valid) {
          getInforDemoList(this.ruleForm.macAddress).then((res) => {
            // console.log(res.data);
            if (!res.data) {
              this.ruleForm.auditStatus = "未提交";
              addInforDemo(this.ruleForm).then((res) => {

                this.$nextTick(()=>{
                this.$refs.ruleForm.resetFields()
                })
                this.getUserIP((ip) => {
                  this.ruleForm.ipAddress = ip;
                });
                var mac = localStorage.getItem("mac");
                this.ruleForm.macAddress = mac;
              })
            } else {
              this.ruleForm.auditStatus = "未提交";
                updateInforDemo(this.ruleForm).then((res=>{
                 
                this.$nextTick(()=>{
                this.$refs.ruleForm.resetFields()
                })
                this.getUserIP((ip) => {
                  this.ruleForm.ipAddress = ip;
                });
                var mac = localStorage.getItem("mac");
                this.ruleForm.macAddress = mac;
                }))
                return false;
        }
          });
          // 保存新增

        }
      });
    },
    approve(ruleForm) {
      this.$refs.ruleForm.validate((valid) => {
        if (
          this.ruleForm.macAddress == "" ||
          this.ruleForm.macAddress == null
        ) {
						let that=this
          this.$alert('<div>MAC地址为空，请点击<a href="https://gitee.com/xcj0654335/macaddr-chrome-extension" style="color:blue" target="_blank">下载插件</a>获取</div>', '标题名称', {
          	            dangerouslyUseHTMLString: true,
          	            callback: action => {
          				  that.disabled=true
          	            }
          	          });
        }
        if (valid) {
          getInforDemoList(this.ruleForm.macAddress).then((res) => {
            if (!res.data) {
              this.ruleForm.auditStatus = "待审核";
              addInforDemo(this.ruleForm).then((res) => {
                this.$refs.ruleForm.resetFields()
				this.getUserIP((ip) => {
				  this.ruleForm.ipAddress = ip;
				});
				var mac = localStorage.getItem("mac");
				this.ruleForm.macAddress = mac;
              })
            } else {
              this.ruleForm.auditStatus = "待审核";
                updateInforDemo(this.ruleForm).then((res=>{
                this.$refs.ruleForm.resetFields()
				this.getUserIP((ip) => {
				  this.ruleForm.ipAddress = ip;
				});
				var mac = localStorage.getItem("mac");
				this.ruleForm.macAddress = mac;


                }))
                return false;
        }
          });
          // 保存新增
        }
      });
    },
    remoteMethodId(query) {
      if (query.length >= 7) {
        getInforDemo(query).then((response) => {
          this.labResponsibleId = response.data;
        });
      }
    },
// 获取IP地址
    getUserIP(onNewIP) {
      let MyPeerConnection =
        window.RTCPeerConnection ||
        window.mozRTCPeerConnection ||
        window.webkitRTCPeerConnection;
      let pc = new MyPeerConnection({
        iceServers: [],
      });
      let noop = () => {};
      let localIPs = {};
      let ipRegex =
        /([0-9]{1,3}(\.[0-9]{1,3}){3}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7})/g;
      let iterateIP = (ip) => {
        if (!localIPs[ip]) onNewIP(ip);
        localIPs[ip] = true;
      };
      pc.createDataChannel("");
      pc.createOffer()
        .then((sdp) => {
          sdp.sdp.split("\n").forEach(function (line) {
            if (line.indexOf("candidate") < 0) return;
            line.match(ipRegex).forEach(iterateIP);
          });
          pc.setLocalDescription(sdp, noop, noop);
        })
        .catch((reason) => {});
      pc.onicecandidate = (ice) => {
        if (
          !ice ||
          !ice.candidate ||
          !ice.candidate.candidate ||
          !ice.candidate.candidate.match(ipRegex)
        )
          return;
        ice.candidate.candidate.match(ipRegex).forEach(iterateIP);
      };
    },
    refresh() {
      //    刷新
      getInforDemoList(this.ruleForm.macAddress).then((res) => {
        if (res.data) {
          this.ruleForm = res.data;
        } else {
          this.$refs.ruleForm.resetFields();
          this.getUserIP((ip) => {
            this.ruleForm.ipAddress = ip;
          });
          var mac = localStorage.getItem("mac");
          this.ruleForm.macAddress = mac;
        }
      });
    },
    change1(value) {
      for (var i = 0; i < this.labResponsibleId.length; i++) {
        if (this.labResponsibleId[i].empId == value) {
          this.loading = true;
          this.ruleForm.labResponsibleMail = this.labResponsibleId[i].mail;
		  this.loading = false;
        }
      }
    },
    change2(value) {
      for (var i = 0; i < this.labResponsibleId.length; i++) {
        if (this.labResponsibleId[i].empId == value) {
          // this.loading = true;
          this.ruleForm.userMail = this.labResponsibleId[i].mail;
          this.ruleForm.userName = this.labResponsibleId[i].empName;
          this.ruleForm.userDuty = this.labResponsibleId[i].title;
          this.ruleForm.userId = this.labResponsibleId[i].empId;
        }
      }
    },
    change3(value) {
      for (var i = 0; i < this.labResponsibleId.length; i++) {
        if (this.labResponsibleId[i].empId == value) {
          this.ruleForm.mailAuditId = this.labResponsibleId[i].empId;
          this.ruleForm.mailAuditDuty = this.labResponsibleId[i].title;
          this.ruleForm.mailAuditMail = this.labResponsibleId[i].mail;
        }
      }
    },
    // ICT专案代码
    getprojectNameList() {
       let str="ictCode"
      getoptionValue(str).then(response => {

         this.from.ictProjectCode = response.data;
      });
    },

    // getprojectNameList() {
    //   // this.loading = true;
    //   let str = "projectName";
    //   getoptionValue(str).then((response) => {


    //   });
    // },
    getfactoryList() {
      let str = "bu";
      getoptionValue(str).then((response) => {
        this.from.factoryCode = response.data;
        console.log(this.from.factoryCode)
      });
    },
    // 厂区代码
    // getBuList() {
    //   this.loading = true;
    //    let str="bu"
    //   getoptionValue(str).then(response => {
    //      this.buOptions = response.data;
    //      this.loading = false;
    //   });
    // },
    getlocationFloorList() {
      // let str = "locationFloor";
      listFloor().then((response) => {
      // console.log(response)
        this.from.projectFloor = response;
        console.log(this.from.projectFloor)
      });
    },
    // 根据mac获取信息
    getList() {
      getInforDemoList(this.ruleForm.macAddress).then((res) => {
        if (res.data) {
          this.ruleForm = res.data;
		  if(this.ruleForm.auditStatus =="待更新"){
		  	this.$notify({
		  	  type: "warning",
		  	  title: "提示",
		  	  dangerouslyUseHTMLString: true,
		  	  message:
		  	    '提交已过期，请重新提交',
		  	  duration: 0,
		  	});
		  }
        } else {
          // this.$refs.ruleForm.resetFields();
          this.getUserIP((ip) => {
          this.ruleForm.ipAddress = ip;
          // this.ruleForm.handlerName = Cookies.get("username");
		})
        }
      });
    },
  },
  created() {
    // this.ruleForm.handlerName = Cookies.get("username");
    console.log(this.ruleForm.handlerName);
    this.getprojectNameList();
    this.getfactoryList();
    this.getlocationFloorList();
    this.getUserIP((ip) => {
      this.ruleForm.ipAddress = ip;
    });
    var mac = localStorage.getItem("mac");
    this.ruleForm.macAddress = mac;
    console.log(this.ruleForm);
    if (this.ruleForm.macAddress == "" || this.ruleForm.macAddress == null) {
		let that=this
	  this.$alert('<div>MAC地址为空，请点击<a href="https://gitee.com/xcj0654335/macaddr-chrome-extension" style="color:blue" target="_blank">下载插件</a>获取</div>', '标题名称', {
	            dangerouslyUseHTMLString: true,
	            callback: action => {
				  that.disabled=true
	            }
	          });
    }
    if (this.ruleForm.macAddress !== "" || this.ruleForm.macAddress !== null) {
      this.getList(this.ruleForm.macAddress);

    } else {

    }
  },
};
</script>

<style lang="scss" scoped>
	.el-divider__text{
		font-size: 20px;
	}
	
.demo-form-inline {
  /* margin-bottom: 20px; */
  width: 100% !important;
  &:last-child {
    margin-bottom: 0;
  }
}

.bottomBtn {
  margin-bottom: 30px !important;
}
.grid-content {
  border-radius: 4px;
}
.title {
  margin-bottom: 40px;
}
::v-deep {
   .el-input__inner{
		font-size: 18px;
        &::placeholder {
           font-size: 18px;
     }
   }
 }
</style>
